<?php
namespace Home\Controller;
use Home\Controller\BaseController;

class IndexController extends BaseController
{
	public function index()
	{
		$this->display('service');
	}
	/**
	 * 关于诚度
	 * 
	 */
	public function about()
	{
		$about = M('about');
		$datalists = $about->order('update_time desc')
		->find();  //find取出一条最新的企业简介
		$imgs = $this->getMberInfo();	
		$this->assign('datalists',$datalists);
		$this->assign('imgs',$imgs);
		$this->display();
	}
	/**
	 * 我们的服务
	 * 
	 */
	public function service()
	{
		$service = M('service');
		$datalists = $service->order('update_time desc')
		->select();//select取出所有服务
		$this->assign('datalists',$datalists);
		$this->display();
	}
	/**
	 * 产品发布
	 * 
	 */
	public function produce()
	{
		$produce = M('produce');
		$datalists = $produce->where('is_display=1')->order('update_time desc')
		->select();
		$pter_lists = $this->partner();
		$this->assign('datalists',$datalists);
		$this->assign('pter_lists',$pter_lists);
		$this->display();
	}
	/**
	 * 详情页
	 */
	public function produce_detail()
	{
		$datalists = $this->detail('produce');
		$this->assign('datalists',$datalists);
		$this->display();
	}
	/**
	 * 合作伙伴
	 * 
	 */
	protected function partner()
	{
		$partner = M('partner');
		$pter_lists = $partner->where('is_display=1')->order('update_time desc')
		->select();
		return $pter_lists;
	}
	/*	获取访客提交的留言
	*/	
	public function getMsg()
	{
		$contact = M('contact');
		if(IS_POST){
			$data = I('post.');
            //新增
			$contact  = $contact->add($data);
			if($contact !== false){
				$res['status'] = 1;
				$res['message'] = '提交成功';
			}else{
				$res['status'] = 0;
				$res['message'] = '提交失败';
			}
			$this->ajaxReturn($res);
		}
	}
	//获取员工信息
	public function getMberInfo()
	{
		$datalists = getImg('member',4);
		return $datalists;

	}
}